FROM openjdk:8-jdk-alpine

ENV SERVICE_VERSION="1.0.0" \
    SERVICE_NAME='spring-boot-docker' \
    SPRING_PROFILES="single" \
    TZ="Asia/Shanghai" \
    JAVA_OPTS="-Xms128m -Xmx128m -Djava.security.egd=file:/dev/./urandom"

# 设置时区
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 设置工作目录
WORKDIR app
# 复制 lib、jar 到容器
COPY ./target/lib ./lib
COPY ./target/${SERVICE_NAME}-${SERVICE_VERSION}.jar .
# 启动 jar
CMD java ${JAVA_OPTS} -jar ${SERVICE_NAME}-${SERVICE_VERSION}.jar --spring.profiles.active=${SPRING_PROFILES}


